#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <algorithm>
#include <map>
#include <climits>
/*
https://www.nowcoder.com/test/question/f5a3b5ab02ed4202a8b54dfb76ad035e?pid=30440590&tid=45777216s
*/

using namespace std;

void dfs(int n,int m,int pos,vector<int> &t,vector<vector<int>> &ans){
    if(0==m){
        ans.push_back(t);
        return;
    }else{
        for(int i=pos;i<=n;i++){
            t.push_back(i);
            dfs(n,m-1,i+1,t,ans);
            t.pop_back();
        }
    }
}

int main(){
    int n,m;
    cin >> n >> m;
    vector<int> t;
    vector<vector<int>> ans;
    dfs(n,m,1,t,ans);
    for(auto v: ans){
        for(auto x:v){
            cout << x << " ";
        }
        cout <<endl;
    }


    return 0;
}